<template>
	<view>

	</view>
</template>

<script>
	export default {
		name:"m-weixin-welcome",
		props: ['show','bildData'],
		data() {
			return {
				// bildData:{
				// 	openid:'',
				// 	mobile:'',
				// 	username:this.$t('login.weixin-data-username'),
				// 	avatar:'',
				// 	password:''
				// },
				wxaction:'reg',
				bildLoading:false
			}
		},
		methods: {
			close(){
				this.$emit('close')
			},
			
			// 绑定账号
			async bindAccount(){
				this.bildLoading = true;
				let data = {};
				data['action'] = this.wxaction;
				data['mobile'] = this.bildData.mobile;
				data['avatar'] = this.bildData.avatar;
				data['username'] = this.bildData.username;
				data['openid'] = this.bildData.openid;
				data['password'] = this.bildData.password;
				data['invitation_code'] = this.invitation_code;
				let res = await this.$api.user.bindUserAccount(data)
				if(res.code == 200){
					// 登录成功
					uni.setStorageSync('authToken',res.data.token)
					this.$util.showToast(this.$t('login.login-success'),function(){
						this.goNavigateBack();
					})
				}
				this.bildLoading = false;
			}
		}
	}
</script>

<style>

</style>